import request from '../utils/request.js'

/**
 * 医生相关API
 */

// 医生注册
export const doctorRegister = (data) => {
  return request.post('/doctor/register', data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 医生登录
export const doctorLogin = (data) => {
  return request.post('/doctor/login', data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 获取医生个人资料
export const getDoctorProfile = (doctorId) => {
  return request.get(`/doctor/profile/${doctorId}`)
}

// 更新医生个人信息
export const updateDoctorProfile = (doctorId, data) => {
  return request.put(`/doctor/profile/${doctorId}`, data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 修改医生密码
export const changeDoctorPassword = (doctorId, data) => {
  return request.put(`/doctor/password/${doctorId}`, data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 上传医生头像
export const uploadDoctorAvatar = (doctorId, file) => {
  const formData = new FormData()
  formData.append('file', file)
  
  return request.post(`/doctor/avatar/${doctorId}`, formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
